home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 265_01 / unxrdsct.c < prev    next >
Text File  |  1990-02-13  |  512b  |  26 lines

  1. /* UNIX(TM) version    */
  2. /* vi: set ai : */
  3. #include <stdio.h>
  4.  
  5. #define    SECTSIZE    512
  6.  
  7. int    rdsct(strtsect, sectbuf)
  8. int    strtsect;
  9. char    *sectbuf;
  10. {
  11. static int    filopen = 0;
  12. static FILE    *fp;
  13.  
  14. if(!filopen)
  15.     if((fp = fopen("/dev/dsk/fd", "r")) == NULL)
  16.         {
  17.         perror("error opening floppy drive");
  18.         exit(1);
  19.         /*NOTREACHED*/
  20.         }
  21.     else
  22.         filopen = 1;
  23. fseek(fp, (long) SECTSIZE * strtsect, 0);
  24. return((fread(sectbuf, sizeof(char), SECTSIZE, fp) == SECTSIZE) ? 0 : 1);
  25. }
  26.